﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace LoanCalculator.Common
{
    public class CommonHelper
    {
        public static double EnsureDouble(object value)
        {
            if (value == null)
                return (0.0d);
            double result = 0.0d;
            double.TryParse(value.ToString(), out result);
            return result;
        }

        public static double EnsureInt(object value)
        {
            if (value == null)
                return (0);
            int result = 0;
            int.TryParse(value.ToString(), out result);
            return result;
        }
    }
}
